//
// Created by Semir on 2020/4/26.
//

#include <iostream>
#include <algorithm>

using namespace std;

struct Person {
    int id;
    int time;
};

const int MAX_N = 1005;
int n;
Person* persons[MAX_N];

bool cmp(Person* p1, Person* p2) {
    return p1->time < p2->time;
}

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        persons[i] = new Person;
        persons[i]->id = i;
        cin >> persons[i]->time;
    }
    sort(persons + 1, persons + 1 + n, cmp);
    double sum = 0.0;
    for (int i = 1; i <= n; i++) {
        cout << persons[i]->id << " ";
    }
    for (int i = 1; i < n; i++) {
        sum = sum + persons[i]->time * (n - i);
    }
    cout << endl;
    printf("%.2f", sum / n);
    return 0;
}